package de.hda.enumeration;

public enum WeekDayEnum {

	SAMSTAG(0, "Sa", "Samstag"),
	SONNTAG(1, "So", "Sonntag"),
	MONTAG(2, "Mo", "Montag"),
	DIENSTAG(3, "Di", "Dienstag"),
	MITTWOCH(4, "Mi", "Mittwoch"),
	DONNERSTAG(5, "Do", "Donnerstag"),
	FREITAG(6, "Fr", "Freitag");
	

	private int value;
	private String shortName;
	private String longName;
	
	private WeekDayEnum(int value, String shortName, String longName) {
		this.value = value;
		this.shortName = shortName;
		this.longName = longName;
	}

	public int getValue() {
		return value;
	}

	public String getShortName() {
		return shortName;
	}

	public String getLongName() {
		return longName;
	}
	
	public static WeekDayEnum fromValue(int value) {
		WeekDayEnum[] enums = WeekDayEnum.values();
		for(WeekDayEnum we : enums) {
			if(we.getValue() == value) {
				return we;
			}
		}
		return null;
	}
	
	public static WeekDayEnum fromShortName(String shortName) {
		WeekDayEnum[] enums = WeekDayEnum.values();
		for(WeekDayEnum we : enums) {
			if(we.getShortName().equals(shortName)) {
				return we;
			}
		}
		return null;
	}
	
	public static WeekDayEnum fromLongName(String longName) {
		WeekDayEnum[] enums = WeekDayEnum.values();
		for(WeekDayEnum we : enums) {
			if(we.getLongName().equals(longName)) {
				return we;
			}
		}
		return null;
	}
	
}
